Skip to content

Drop a response whose header holds a NUL byte - #2239

Open
xroche wants to merge 5 commits into
masterfrom
header-nul
Open

xroche wants to merge 5 commits into
masterfrom
header-nul

Conversation

@xroche

@xroche xroche commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

httrack now drops a response whose header holds a NUL byte, because its line reader stops at the NUL and hides the fields after it. RFC 9110 section 5.5 also allows a space in place of the NUL, but rejecting is safer and matches how #2237 drops untrusted framing.

Closes #2238

xroche and others added 5 commits November 14, 2026 18:06
The header reader ends a line at a NUL, so "Content-Length: 16\0, 8"
hid the ", 8", and a NUL before the line end could end the header block
early. RFC 9110 section 5.5 lets a recipient reject such a field or
replace the NUL with a space. Rejecting is the safer choice: a space
would let the hidden value through, and #2237 already drops a response
whose framing headers cannot be trusted.

Closes #2238

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Add fixtures for a Set-Cookie before the NUL line, a NUL in the status
line, a NUL-filled body and a headerless reply holding a NUL, and run
the error count last so each mutant fails on its own assertion. Make
the htsback.c comments accurate and translate the French ones touched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche enabled auto-merge (squash) November 14, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A NUL byte in a response header splits or ends the header lines

1 participant